import { GBox } from "../../../../../com/mui/containers/GBox";
import { DailySpecialInfo } from "../../../model/DailySpecialInfo";
import { UICompomentPool } from "../../../../../com/mui/utils/UICompomentPool";
import { OpenSeverNewRewardItem } from "./OpenSeverNewRewardItem";
type int = number;
//class OpenSeverNewRewardBody
    
    export  class OpenSeverNewRewardBody extends GBox
    {
        constructor()
        {
            super();
            return;
        }

        public addItem(arg1: DailySpecialInfo, arg2: int): void
        {
            this._info = arg1;
            var loc1=UICompomentPool.getUICompoment(OpenSeverNewRewardItem);
            loc1.updateData(arg1, arg2);
            addChild(loc1);
            return;
        }

        public onGetRewardRes(arg1: int, arg2: int): void
        {
            var loc1=null;
            if (this._info && this._info.code == arg1) 
            {
                loc1 = getChildAt(arg2) as OpenSeverNewRewardItem;
                if (loc1) 
                {
                    loc1.onGetRewardRes();
                }
            }
            return;
        }

        public onActiveConditionUpdate(arg1: Array<any>): void
        {
            var loc1=0;
            var loc2=0;
            var loc3=null;
            if (this._info && !(arg1.indexOf(this._info) == -1)) 
            {
                loc2 = numChildren;
                while (loc1 < loc2) 
                {
                    if (loc3 = getChildAt(loc1) as OpenSeverNewRewardItem) 
                    {
                        loc3.updateData(this._info, loc1);
                    }
                    ++loc1;
                }
            }
            return;
        }

        public updataGetRewardState(arg1: Array<any>): void
        {
            var loc1=0;
            var loc2=0;
            var loc3=null;
            if (this._info && arg1.length > 0) 
            {
                loc2 = numChildren;
                while (loc1 < loc2) 
                {
                    if (loc3 = getChildAt(loc1) as OpenSeverNewRewardItem) 
                    {
                        loc3.updataGetRewardState(arg1[loc1]);
                    }
                    ++loc1;
                }
            }
            return;
        }

        public goInvalidate(): void
        {
            this.invalidate();
            return;
        }

        public /* override */ dispose(arg1: Boolean=true): void
        {
            this._info = null;
            super.dispose(arg1);
            return;
        }

        public /* override */ get height(): number
        {
            var loc1=0;
            var loc3=null;
            var loc4=0;
            var loc2=numChildren;
            while (loc1 < loc2) 
            {
                loc3 = getChildAt(loc1);
                loc4 = loc4 + (loc3.height + verticalGap);
                ++loc1;
            }
            return loc4;
        }

        /* internal */ /* var */_info: DailySpecialInfo;
    }
